package com.nancy.aop.aop.advisor;

import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;

import java.lang.reflect.Method;

/**
 * All rights Reserved, Designed By guangfeng.zhou
 *
 * @version V1.0
 * @Project: learning-demo
 * @Package: com.nancy.aop
 * @Description: (用一句话描述该文件做什么)
 * @author: guangfeng.zhou
 * @date: 2017/12/5 13:08
 */
public class PrintMsgAdvisor extends StaticMethodMatcherPointcutAdvisor{

    /**
     * 切点方法匹配规则
     * @param:
     * @return:
     */
    public boolean matches(Method method, Class<?> aClass) {
        return "printMsg".equals(method.getName()) ;
    }

    /**
     * 切点方法匹配规则 为TestAopImpl类或者子类
     * @param:
     * @return:
     */
//    @Override
//    public ClassFilter getClassFilter() {
//        return new ClassFilter(){
//            public boolean matches(Class<?> aClass) {
//                return TestAopImpl.class.isAssignableFrom(aClass) ;
//            }
//        };
//    }

}
